#include <stdio.h>
#include <stdlib.h>
#include "clist.h"
#include "csort.h"
#include "myvector.h"
#include <iostream>
#include <vector>

void testList();
void testSort();
void testMyVector();


int main() {

	
	testMyVector();


	// system("pause");
	return 0;
}

void testMyVector(){
	MyVector<int> vec;
	vec.push_back(12);
	vec.push_back(22);
	vec.push_back(32);
	vec.push_back(44);
	vec.push_back(256);
	vec.push_back(280);
	vec.push_back(320);
	vec.pop_back();

	std::cout << "vec data[" << vec.capacity() << "|" << vec.size() << "]: ";
	for(int i = 0; i < vec.size(); i++){
		std::cout << vec[i] << " ";
	}
	std::cout << std::endl;

	MyVector<int> vec2(vec);
	std::cout << "vec2 data[" << vec2.capacity() << "|" << vec2.size() << "]: ";
	for(int i = 0; i < vec2.size(); i++){
		std::cout << vec2[i] << " ";
	}
	std::cout << std::endl;

	MyVector<int> vec3;
	vec3.push_back(99);
	vec3.push_back(88);
	vec3.push_back(77);

	vec2 = vec3;
	std::cout << "vec2 data[" << vec2.capacity() << "|" << vec2.size() << "]: ";
	for(int i = 0; i < vec2.size(); i++){
		std::cout << vec2[i] << " ";
	}
	std::cout << std::endl;
}

void testList(){
	// Node* pHead1 = NULL;
	// Node* pHead2 = NULL;

	// pHead1 = tailInsert(pHead1, 12);
	// pHead1 = tailInsert(pHead1, 56);
	// pHead1 = tailInsert(pHead1, 88);
	// pHead1 = tailInsert(pHead1, 256);
	// printList(pHead1);

	// pHead2 = tailInsert(pHead2, 9);
	// pHead2 = tailInsert(pHead2, 32);
	// pHead2 = tailInsert(pHead2, 88);
	// pHead2 = tailInsert(pHead2, 514);
	// pHead2 = tailInsert(pHead2, 888);
	// printList(pHead2);


	// Node* pHead = mergeList(pHead1, pHead2);
	// printList(pHead);

	Node* pHead = NULL;
	pHead = tailInsert(pHead, 23);
	pHead = tailInsert(pHead, 10);
	pHead = tailInsert(pHead, 88);
	pHead = tailInsert(pHead, 4);
	pHead = tailInsert(pHead, 256);
	pHead = tailInsert(pHead, 512);
	pHead = blblSortList(pHead);
	printList(pHead);
}

void testSort(){
	int ary[] = {22, 5, 105, 88, 32, 10, 9, 75};
	int len = sizeof(ary) / sizeof(ary[0]);

	blblSort(ary, len);

	printf("ary: ");
	for(int i = 0; i < len; i++){
		printf("%d ", ary[i]);
	}
	printf("\n");
}